#!/bin/bash

generageApi() {
    goctl api plugin -plugin goctl-swagger="swagger -filename $1.json" -api /home/zhubing/web/golang/src/go-zero/book/service/$1/cmd/api/$1.api -dir /home/zhubing/web/code/apidoc/go-zero
}

single_service_name=$1
if [ single_service_name != "" ]; then
    generageApi single_service_name
else
    api_service_list=("user" "sstwords" "search" "shorturl")
    for api_service_name in ${api_service_list[@]}; do
        echo ${api_service_name}
        generageApi ${api_service_name}
    done
fi
